package com.auxgroup.smarthome;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Stream;

/**
 * Created by kevinchen on 2017/8/14.
 */
public class StreamDemo {

    public static List<Integer> demoList = new ArrayList<>();

    public static void main(String[] args) {

        Integer[] demos = new Integer[25];
        Arrays.parallelSetAll( demos, index -> ThreadLocalRandom.current().nextInt(10000 ));
        demoList = Arrays.asList(demos);
        Stream<Integer> stream = demoList.stream();
        demoList.stream().limit(20).forEach(integer -> System.out.print(integer+","));
        System.out.println("==============");
        demoList.stream().limit(10).forEach(integer -> System.out.print(integer+","));
        System.out.println("==============");
        demoList.stream().skip(10).limit(15).forEach(integer -> System.out.print(integer+","));
    }

}
